package com.hitnet.hitnet.pic;

import android.app.AlertDialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.hitnet.hitnet.R;

public class MyDialog extends AlertDialog{
	private String mcontent; //
	private TextView tv_content;
	private ClickListener onClickListener;
	public MyDialog(Context context, String content) {
		super(context);
		mcontent = content;
	}
	
	public void setOnClickListener(ClickListener onClickListener) {
		this.onClickListener = onClickListener;
	}
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.confirm_dialog);
		tv_content = (TextView) findViewById(R.id.tv_content);
		tv_content.setText(mcontent);
		Button btn_ok = (Button) findViewById(R.id.button_ok);
		Button btn_cancel = (Button) findViewById(R.id.button_cancel);
		btn_ok.setOnClickListener(new View.OnClickListener() {
			public void onClick(View v) {
				onClickListener.onButtonOk();
			}
		});
		btn_cancel.setOnClickListener(new View.OnClickListener() {
			public void onClick(View v) {
				onClickListener.onButtonCancel();
			}
		});
		
	}

	interface ClickListener{
		public void onButtonOk();
		public void onButtonCancel();
	}
}
